package com.wicket.okrframework.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import com.wicket.okrframework.common.util.RedisUtil;
import com.wicket.okrframework.common.exception.BizException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

import java.util.List;
import java.util.stream.Collectors;
import com.wicket.okrframework.biz.service.nb.NbCaptcha;

/**
 * @author ：
 * @date ：
 *
 * 
 * @version 1.0
 */
@Service
public class CaptchaServiceImpl implements com.wicket.okrframework.biz.service.CaptchaService {
    @Resource
    private RedisUtil redisUtil;
//@Resource
 //private MSpecMethordTableService mSpecMethordTableService;
@Resource
  private NbCaptcha nbCaptcha;
/**
   * D1-检测验证码是否有效（特殊方法）[1185]
   * gen by moon at 10/2/2022, 12:00:37 AM
   */
  @Trace(operationName = "D1-检测验证码是否有效（特殊方法）")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public CheckCaptchaValidRespDto checkCaptchaValid(CheckCaptchaValidReqDto reqDto){
    
      
      CheckCaptchaValidRespDto checkCaptchaValidRes_1 =null;
//步骤0: M-检测验证码是否有效（特殊方法） - checkCaptchaValid
     //ModelCode: checkCaptchaValid
        CheckCaptchaValidRespDto checkCaptchaValidRes = null;
    CheckCaptchaValidReqDto checkCaptchaValidReq=new CheckCaptchaValidReqDto();
  if(reqDto!=null){
      checkCaptchaValidReq.setPhone(reqDto.getPhone());//SimpleFieldAssign//sourceId:43316_1
checkCaptchaValidReq.setVerificationCode(reqDto.getVerificationCode());//SimpleFieldAssign//sourceId:43293_1
    }
  
    /*M-检测验证码是否有效（特殊方法）[1421]  用于检测用户前端录入验证码是否有效 */
    
      checkCaptchaValidRes = nbCaptcha.checkCaptchaValid(checkCaptchaValidReq);
      

      checkCaptchaValidRes_1 = checkCaptchaValidRes;
    
CheckCaptchaValidRespDto retData = new CheckCaptchaValidRespDto();
  if(checkCaptchaValidRes_1!=null){
      retData.setIsInvalid(checkCaptchaValidRes_1.getIsInvalid());//SimpleFieldAssign//sourceId:43363_1
    }
  

  
  
return retData;
  }
    
    //
}
